//
// Ishtar C++ Utility Library
//
// Task Facility - Work Executer Private Header
//

#ifndef __ISHTAR_TASK_WORK_EXECUTOR_IMPL_H
#define __ISHTAR_TASK_WORK_EXECUTOR_IMPL_H

#include <Ishtar/Ishtar.h>

#if defined( ISHTAR_COMPILER_HAS_PRAGMA_ONCE )
#pragma once
#endif

#include <Ishtar/InterlockedInteger.h>
#include <Ishtar/Task/WorkImpl.h>


namespace Ishtar
{

namespace Task
{

///////////////////////////////////////////////////////////////////////////////
//
// Work Executor
//

class WorkExecutorImpl
{
public:

    virtual ~WorkExecutorImpl() {}

    virtual void AddReadyWork( const WorkImplPtr& w ) = 0;

    Uint GetNumWorks() const { return m_numWorks; }


    /// Number of Works are updated by Works ///

    void IncrementNumWorks() { m_numWorks.Increment(); }
    void DecrementNumWorks() { m_numWorks.Decrement(); }

private:

    InterlockedUint m_numWorks;
};


///////////////////////////////////////////////////////////////////////////////

} // namespace Task

} // namespace Ishtar

#endif // __ISHTAR_TASK_WORK_EXECUTOR_IMPL_H
